<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" href="./public/reset.css">
    <link rel="stylesheet" href="./css/cart.css">
    <script>
        if(localStorage.getItem("isLogin") !== "ok"){
        alert("未登录状态，不允许打开购物车，请先登录")
        location.href = "./login.html"
    }
</script>
</head>

<body>
    <div id="header"></div>
    <div id="nav">
        <h2><a href="./goodsList.html">继续购物</a></h2>
    </div>
    <table>
        <thead>
            <tr>
                <th width="40">选中</th>
                <th width="100">图片</th>
                <th>名称</th>
                <th width="70">数量</th>
                <th width="70">价格</th>
                <th width="80">合计</th>
                <th width="60">操作</th>
            </tr>
        </thead>
        <tbody>
        </tbody>
    </table>
    <div id="总计"></div>
    <div id="footer"></div>
</body>
<script src="./public/JQuery/jquery.min.js"></script>
<script src="./JSlibrary/ajax.js"></script>
<script src="./JSlibrary/cart.js"></script>
<script>
    $("#header").load("http://localhost:3000/public/public.html .header", function () {
            const oun = document.querySelector(".un");
            const exit=document.querySelector(".exit")
            if (localStorage.getItem("isLogin") === "ok") {
                oun.innerHTML = localStorage.getItem("username");
                exit.style.display="inlineBlock";
                exit.onclick=function(){
                    localStorage.removeItem("username");
                    localStorage.setItem("isLogin", "");
                    location.href = "./index.html";
                }
            } else {
                oun.innerHTML=`<a href="./login.html">登录<a>`;
                exit.style.display="none";
    
            }
        })
</script>
<script>
    $("#footer").load("http://localhost:3000/public/public.html .footer")
</script>

</html>